<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    /*
      map,forEach,filter,for of for in
    
    */
    let arr = [1, 2, 3, 4, 5]
    // arr.forEach(v => {
    //   console.log(v);
    // })
    // let result = arr.map(v => {
    //   return v
    // })
    // console.log(result);
    let res = arr.reduce((pre, item) => {
      // console.log(`pre`, pre);
      // console.log(`item`, item);//每一项->index+1
      return pre + item
    }, 0)
    console.log(res);
  </script>
</body>

</html>